<?
ob_start();
session_start();
include "checksession.php";
date_default_timezone_set('Asia/Bangkok');
$id_member = $_SESSION["id_member"];
include "../connect.php";

$strSQL = "SELECT * FROM employee WHERE emp_id = '$id_member' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
$emp_nameTh=$objResult["emp_nameTh"];

if($_GET["Action"] == "Save")
{
	//*** Insert Question ***//
	$strSQL = "INSERT INTO webboard ";
	$strSQL .="(CreateDate,Question,Details,Name) ";
	$strSQL .="VALUES ";
	$strSQL .="('".date("Y-m-d H:i:s")."','".$_POST["txtQuestion"]."','".$_POST["txtDetails"]."','".$_POST["txtName"]."') ";
	$objQuery = mysql_query($strSQL);
	
	if($objQuery){
	echo "<script language='javascript'>
			   setTimeout(\"parent.$.fancybox.close()\"); 
			  </script>";
		 }
	//header("location:Webboard.php");
}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Adinop Co., Ltd. was founded as an ingredients importer and local manufacturers’ distributor in 1986. We also function as an exporter of finished products</title>
  <link rel="stylesheet" href="../css/style.css"/>

  <script language="javascript">
			function CheckValidate()
			{
			if(eval("document.frmMain.txtQuestion.value")==""){
				alert("กรุณากรอกช่อง หัวข้อคำถาม");
				eval("document.frmMain.txtQuestion.focus();")
				return false;
				}

			if(eval("document.frmMain.txtDetails.value")==""){
				alert("กรุณากรอกช่อง รายละเอียด");
				eval("document.frmMain.txtDetails.focus();")
				return false;
				}
			}
</script>
</head>
<body>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
 <body class="body">
 <div align ="center">
<div class="nameTitle">ใบทะเบียนประวัติเจ้าหน้าที่</div>
<br/>
<form action="NewQuestion.php?Action=Save" method="post" name="frmMain" id="frmMain" OnSubmit="return CheckValidate();">
  <table width="750" border="1" cellpadding="1" cellspacing="0" class="simply">
    <tr>
      <th width="100" height ="50" align="right">หัวข้อคำถาม : </th>
      <td><input name="txtQuestion" type="text" id="txtQuestion" value="" size="70"></td>
    </tr>
    <tr>
      <th width="78" height ="50" align="right">รายละเอียด : </th>
      <td><textarea name="txtDetails" cols="50" rows="5" id="txtDetails"></textarea></td>
    </tr>
    <tr>
      <th width="78" height ="50" align="right">ชื่อผู้แจ้ง : </th>
      <td width="647"><input name="txtName" type="text" id="txtName" value="Administrator" size="50" readonly=""></td>
    </tr>
  </table>
  <br/>
  <input name="btnSave" type="submit" id="btnSave" value="ตกลง"  style="height: 30px; width: 120px"/>
</form>
</div>
</body>
</html>
<?
mysql_close($connection);
?>